home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Macintosh Demo Applications CD
/
Apple-MacintoshDemoApplicationsCD-1.0-1992.iso
/
More Information
/
QuicKeys
/
For Programmers Only.sea
/
Pascal Examples
/
SampleUI.p
< prev
next >
Wrap
Text File
|
1991-06-22
|
3KB
|
106 lines
(* $Workfile$ *)
(* $Revision$ *)
{ QuicKeys 2™ sample extension user interface routine }
{ © 1990 CE Software, Inc. All rights reserved.}
{ For QuicKeys 2 Extension Sample source code you have a royalty-free right }
{ to include object code derived from this Sample source code in programs }
{ that you develop. You also have the right to use, distribute, and license }
{ such programs to third parties without payment of any further license fees }
{ to CE Software, Inc., so long as a copyright notice sufficient to protect }
{ your copyright for your software in the United States or any other country; }
{ is included in the graphic display of your software and on the labels }
{ affixed to the media on which your software is distributed. }
{ WHEN WHO WHAT}
{•••••}
{ 9/5 mkg created version for either MPW or Think Pascal}
{ 6/17 mkg support balloon help}
{•••••}
unit SampleExtensionUI;
interface
uses
{$ifc UNDEFINED THINK_PASCAL}
Memtypes, Quickdraw, OSIntf, ToolIntf, packages,
{$endc}
extensions, SampleData;
{$D-}
{$R-}
function main (wSelector: integer;
pDialog: DialogPtr;
wHitItem: integer;
wFirstItem: integer;
var myData: SampleDataRec;
lRefCon: longint): longint;
implementation
const
ditlWaitTime = 1; { dialog item of edittext item }
function main (wSelector: integer;
pDialog: DialogPtr;
wHitItem: integer;
wFirstItem: integer;
var myData: SampleDataRec;
lRefCon: longint): longint;
var
strWaitTime: str255;
wType: integer;
hItem: Handle;
rDitl: Rect;
hHelp: Handle;
begin
case wSelector of
newUI:
begin
{ the user has just created a new key. initialize it }
myData.lWaitTime := 0;
myData.hdr.wLength := sizeof(SampleDataRec);
end;
initUI:
begin
{ QuicKeys 2™ is about to display our dialog. preset our dialog items }
NumToString(MyData.lWaitTime, strWaitTime);
GetDItem(pDialog, ditlWaitTime + wFirstItem, wType, hItem, rDitl);
SetIText(hItem, strWaitTime);
{ fudge the hdlg resource to set the number of dialog items to skip }
hHelp := GetResource('hdlg', -14348);
if hHelp <> nil then
BlockMove(@wFirstItem, pointer(ord4(hHelp^) + 2), 2);
end;
hitUI:
begin
{ the user clicked or typed into one of our items }
{ In this example, there is nothing to do }
end;
doneUI:
{ The user has clicked ok or cancel. }
{ Collect items from dialog and place in key data.}
{ Important note: Since QuicKeys gives us a copy of the key data to }
{ work on, we don't care whether user hit ok or cancel. QuicKeys will }
{ discard the copy if the user hit cancel or update the actual key data }
{ if the user hit ok. }
begin
GetDItem(pDialog, ditlWaitTime + wFirstItem, wType, hItem, rDitl);
GetIText(hItem, strWaitTime);
StringToNum(strWaitTime, myData.lWaitTime)
end;
end;
main := 0;
end;
end.